package com.xbongbong.saas.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @description 重复规则匹配方式枚举
 * @author yanglei
 * @date 2022/11/9 15:37
 */
@Getter
public enum RecheckMatchWayEnum {

    /**
     * 精确匹配
     */
    EXACT_MATCH("enum.RecheckMatchWay.name.exactMatch" ,1),
    /**
     * 模糊匹配
     */
    FUZZY_MATCH("enum.RecheckMatchWay.name.fuzzyMatch",2);

    /** 枚举值 -- */
    private String name;
    /** 枚举信息--中文名称 */
    private Integer code;

    RecheckMatchWayEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    public static RecheckMatchWayEnum getByCode(Integer code){
        for (RecheckMatchWayEnum cacheCode : values()) {
            if (Objects.equals(code, cacheCode.getCode())) {
                return cacheCode;
            }
        }
        return null;
    }

}
